package wyn.spec.edu.week12_class01;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.List;

public class WeChatAdapter extends ArrayAdapter<wechat> {
    private int resourcId;
    public WeChatAdapter(Context context, int textViewResourceId, List<wechat> objects){
        super(context,textViewResourceId,objects);
        resourcId=textViewResourceId;
    }
    public View getView(int position,View contextView,ViewGroup parent){
        wechat w=getItem(position);
        View view=LayoutInflater.from(getContext()).inflate(resourcId,parent,false);
        ImageView wechatImage=(ImageView) view.findViewById(R.id.wechat_image);
        TextView wechatName=(TextView) view.findViewById(R.id.wechat_name);
        TextView wechatWz=(TextView) view.findViewById(R.id.wechat_wz);
        wechatImage.setImageResource(w.getImage());
        wechatName.setText(w.getName());
        wechatWz.setText(w.getWz());
        return view;

    }
}
